
const isHtmlElement = function (printable) {
    return typeof printable === 'object' && printable && (printable instanceof HTMLElement)
}

const queryPagedjsContent = function (element) {
    let htmlElement = isHtmlElement(element) ? element : document.getElementById(element)
    let template = element.querySelector(":scope > template[data-ref='pagedjs-content']");

    if (!template) {
        template = document.createElement("template");
        template.dataset.ref = "pagedjs-content";
        template.innerHTML = htmlElement.innerHTML;
        htmlElement.innerHTML = "";
        htmlElement.appendChild(template);
    }
    return template
}

export * from './print.js'
export * from 'pagedjs'
export { queryPagedjsContent }